home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / xampp-win32-1.6.5-installer.exe / phpMyAdmin / libraries / db_links.inc.php < prev    next >
Encoding:
PHP Script  |  2007-12-20  |  3.9 KB  |  140 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: db_links.inc.php 10240 2007-04-01 11:02:46Z cybot_tm $
  6.  */
  7.  
  8. /**
  9.  *
  10.  */
  11. require_once './libraries/common.inc.php';
  12.  
  13. require_once './libraries/relation.lib.php';
  14. /**
  15.  * Gets the relation settings
  16.  */
  17. $cfgRelation = PMA_getRelationsParam();
  18.  
  19. /**
  20.  * If coming from a Show MySQL link on the home page,
  21.  * put something in $sub_part
  22.  */
  23. if (empty($sub_part)) {
  24.     $sub_part = '_structure';
  25. }
  26.  
  27. /**
  28.  * Checks for superuser privileges
  29.  */
  30. $is_superuser = PMA_isSuperuser();
  31.  
  32. /**
  33.  * Prepares links
  34.  */
  35. // Drop link if allowed
  36. // rabus: Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
  37. // nijel: Don't allow to easilly drop mysql database, RFE #1327514.
  38. if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) {
  39.     $tab_drop['link'] = 'sql.php';
  40.     $tab_drop['args']['sql_query']  = 'DROP DATABASE ' . PMA_backquote($db);
  41.     $tab_drop['args']['zero_rows']  = sprintf($GLOBALS['strDatabaseHasBeenDropped'], htmlspecialchars(PMA_backquote($db)));
  42.     $tab_drop['args']['goto']       = 'main.php';
  43.     $tab_drop['args']['back']       = 'db' . $sub_part . '.php';
  44.     $tab_drop['args']['reload']     = 1;
  45.     $tab_drop['args']['purge']      = 1;
  46.     $tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
  47. }
  48.  
  49. /**
  50.  * export, search and qbe links if there is at least one table
  51.  */
  52. if ($num_tables == 0) {
  53.     $tab_qbe['warning'] = $strDbIsEmpty;
  54.     $tab_search['warning'] = $strDbIsEmpty;
  55.     $tab_export['warning'] = $strDbIsEmpty;
  56. }
  57.  
  58. $tab_structure['link']  = 'db_structure.php';
  59. $tab_structure['text']  = $GLOBALS['strStructure'];
  60. $tab_structure['icon']  = 'b_props.png';
  61.  
  62. $tab_sql['link']        = 'db_sql.php';
  63. $tab_sql['args']['db_query_force'] = 1;
  64. $tab_sql['text']        = $GLOBALS['strSQL'];
  65. $tab_sql['icon']        = 'b_sql.png';
  66.  
  67. $tab_export['text']     = $GLOBALS['strExport'];
  68. $tab_export['icon']     = 'b_export.png';
  69. $tab_export['link']     = 'db_export.php';
  70.  
  71. $tab_search['text']     = $GLOBALS['strSearch'];
  72. $tab_search['icon']     = 'b_search.png';
  73. $tab_search['link']     = 'db_search.php';
  74.  
  75. $tab_qbe['text']        = $GLOBALS['strQBE'];
  76. $tab_qbe['icon']        = 's_db.png';
  77. $tab_qbe['link']        = 'db_qbe.php';
  78.  
  79. if ($cfgRelation['designerwork']) {
  80.     $tab_designer['text']   = $GLOBALS['strDesigner'];
  81.     $tab_designer['icon']   = 'b_relations.png';
  82.     $tab_designer['link']   = 'pmd_general.php';
  83. }
  84.  
  85. if (! $db_is_information_schema) {
  86.     $tab_import['link']     = 'db_import.php';
  87.     $tab_import['text']     = $GLOBALS['strImport'];
  88.     $tab_import['icon']     = 'b_import.png';
  89.     $tab_drop['text']       = $GLOBALS['strDrop'];
  90.     $tab_drop['icon']       = 'b_deltbl.png';
  91.     $tab_drop['class']      = 'caution';
  92.     $tab_operation['link']  = 'db_operations.php';
  93.     $tab_operation['text']  = $GLOBALS['strOperations'];
  94.     $tab_operation['icon']  = 'b_tblops.png';
  95.     if ($is_superuser) {
  96.         $tab_privileges['link'] = 'server_privileges.php';
  97.         $tab_privileges['args']['checkprivs']       = $db;
  98.         // stay on database view
  99.         $tab_privileges['args']['viewing_mode'] = 'db';
  100.         $tab_privileges['text'] = $GLOBALS['strPrivileges'];
  101.         $tab_privileges['icon'] = 's_rights.png';
  102.     }
  103. }
  104.  
  105. /**
  106.  * Displays tab links
  107.  */
  108. $tabs = array();
  109. $tabs[] =& $tab_structure;
  110. $tabs[] =& $tab_sql;
  111. $tabs[] =& $tab_search;
  112. $tabs[] =& $tab_qbe;
  113. $tabs[] =& $tab_export;
  114. if (! $db_is_information_schema) {
  115.     $tabs[] =& $tab_import;
  116.     if ($cfgRelation['designerwork']) {
  117.         $tabs[] =& $tab_designer;
  118.     }
  119.     $tabs[] =& $tab_operation;
  120.     if ($is_superuser) {
  121.         $tabs[] =& $tab_privileges;
  122.     }
  123.     if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
  124.         $tabs[] =& $tab_drop;
  125.     }
  126. }
  127.  
  128. echo PMA_getTabs($tabs);
  129. unset($tabs);
  130.  
  131. /**
  132.  * Displays a message
  133.  */
  134. if (!empty($message)) {
  135.     PMA_showMessage($message);
  136.     unset($message);
  137. }
  138. ?>
  139. <br />
  140.